<template>
    <view @tap="__e" class="order-item" :data-event-opts="[['tap', [['handleClick', ['$event']]]]]" hoverClass="none">
        <view @tap.stop.prevent="__e" class="order-item-header" :data-event-opts="[['tap', [['', ['$event']]]]]">
            <view @tap="__e" class="check-box" :data-event-opts="[['tap', [['handleCheck', ['$event']]]]]" style="margin-right: 20rpx" v-if="isSelectMode && isSelectable">
                <image src="https://img121.7dun.com/yuanqimali/share/chenckBox-on.png" style="width: 28rpx; height: 28rpx" v-if="isSelected"></image>
                <image src="https://img121.7dun.com/yuanqimali/share/chenckBox.png" style="width: 28rpx; height: 28rpx" v-else></image>
            </view>
            <text class="time">{{ order.sid }}</text>
            <view class="node-type">{{ order.node_type_text }}</view>
            <view class="node-type" v-if="order.options && order.options.is_hidden_sku">隐藏款</view>
            <view :class="['shang-title', order.options.shang_type === 1 ? 'strong' : '']" v-if="order.options && order.options.shang_title">{{ order.options.shang_title }}</view>
            <view style="flex-grow: 1"></view>
            <view :class="['status', order.union_status]">{{ '' + order.union_status_text + '' }}</view>
        </view>
        <view class="products">
            <sku-info @__l="__l" class="sku" :disableClick="true" :info="order" :myInfo="myInfo" vueId="9faf80a2-1"></sku-info>
        </view>
        <view @tap.stop.prevent="__e" class="bottom-actions" :data-event-opts="[['tap', [['', ['$event']]]]]">
            <text style="color: #6c727a; font-size: 24rpx">{{ $root.g0 }}</text>
            <view class="presell-c" v-if="info.is_presell">
                <text class="tag">预售</text>
                <text class="date">{{ info.presell_date + '后可发货' }}</text>
            </view>
            <view style="flex-grow: 1"></view>
            <block v-if="order.union_status == 'pending'">
                <view @tap="__e" class="lock-btns" :data-event-opts="[['tap', [['handleLock', ['$event']]]]]">
                    <text class="new-iconfont icon-lock"></text>
                </view>
                <button @tap="__e" class="lock-btn" :data-event-opts="[['tap', [['handleVirtualAssetPick', ['$event']]]]]" hoverClass="hover" v-if="isVirtualAsset">领取</button>
                <button
                    @tap="__e"
                    class="lock-btn"
                    :data-event-opts="[['tap', [['handleClick2', ['$event']]]]]"
                    data-type="返售"
                    hoverClass="hover"
                    v-if="isReturnSaleable && myInfo.level > 4"
                >
                    分解
                </button>
                <button
                    @tap="__e"
                    :data-event-opts="[['tap', [['handleClick2', ['$event']]]]]"
                    data-type="转售"
                    hoverClass="hover"
                    style="background-color: #5b55ff; color: aliceblue"
                    v-if="order.money_price < 10000 || order.node_type_text == '抽奖' ? false : true && myInfo.level > 4"
                >
                    挂售
                </button>
            </block>
            <block v-else>
                <button
                    @tap="__e"
                    class="lock-btn"
                    :data-event-opts="[['tap', [['handleUnlock', ['$event']]]]]"
                    data-type="解锁"
                    hoverClass="hover"
                    v-if="order.union_status == 'locked'"
                >
                    解锁
                </button>
                <block v-else>
                    <button
                        @tap="__e"
                        class="lock-btn"
                        :data-event-opts="[['tap', [['checkResaleDetail', ['$event']]]]]"
                        data-type="查看转售"
                        hoverClass="hover"
                        style="color: #ffffff"
                        v-if="order.union_status == 'resale_pending'"
                    >
                        查看转售
                    </button>
                    <block v-else>
                        <block v-if="order.union_status == 'picked'">
                            <button
                                @tap="__e"
                                class="bg-yellow"
                                :data-event-opts="[['tap', [['handleClick2', ['$event']]]]]"
                                data-type="查看订单"
                                hoverClass="hover"
                                v-if="order.pick_order"
                            >
                                查看订单
                            </button>
                        </block>
                    </block>
                </block>
            </block>
        </view>
    </view>
</template>

<script>
import skuInfo from '@/pages/myBox/components/SkuInfo';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/myBox/components/PackageSku'],
    {
        '0aa3': function (t, e, n) {
            'use strict';

            (function (t) {
                var i = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var o = {
                    mixins: [i(n('452d')).default],
                    props: {
                        order: {
                            type: Object
                        },
                        isSelected: {
                            type: Boolean
                        },
                        isSelectMode: {
                            type: Boolean
                        },
                        selectType: {
                            type: String
                        },
                        myInfo: {
                            type: Object
                        }
                    },
                    components: {
                        SkuInfo: function () {
                            n.e('pages/myBox/components/SkuInfo')
                                .then(
                                    function () {
                                        return resolve(n('fccf'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    data: function () {
                        return {
                            hours: '',
                            minutes: '',
                            seconds: '',
                            closeTimeVisible: false,
                            timer: null
                        };
                    },
                    computed: {
                        info: function () {
                            return this.order;
                        },
                        orderConfig: function () {
                            return this.$store.getters.setting.order || {};
                        },
                        marketConfig: function () {
                            return this.$store.getters.setting.market || {};
                        },
                        isSelectable: function () {
                            return (
                                'pending' === this.info.union_status &&
                                ('deliver' === this.selectType
                                    ? 'virtual_asset' !== this.info.sku_type_text && !this.info.is_presell
                                    : 'return_sale' !== this.selectType || this.isReturnSaleable)
                            );
                        },
                        isVirtualAsset: function () {
                            return 'virtual_asset' === this.info.sku_type_text;
                        },
                        isReturnSaleable: function () {
                            return this.orderConfig.is_return_sale_enable && !this.isVirtualAsset && this.info.is_return_saleable;
                        },
                        isResaleable: function () {
                            return !this.isVirtualAsset && this.info.is_resaleable;
                        }
                    },
                    filters: {
                        dateformat: function (t) {
                            return this.$tool.formatDate(t, 'MM-dd hh:mm');
                        }
                    },
                    created: function () {},
                    destroyed: function () {},
                    methods: {
                        handleLock: function () {
                            var that = this;
                            t.showLoading({
                                title: '转入中~',
                                icon: 'none'
                            });
                            this.$http('/package-skus/'.concat(this.info.uuid, '/lock'), 'POST').then(function (n) {
                                t.showToast({
                                    title: '已转入保险箱~',
                                    icon: 'none'
                                });
                                that.$emit('refresh');
                            });
                        },
                        handleUnlock: function () {
                            var that = this;
                            t.showLoading({
                                title: '解锁中~',
                                icon: 'none'
                            });
                            this.$http('/package-skus/'.concat(this.info.uuid, '/unlock'), 'POST').then(function (n) {
                                t.showToast({
                                    title: '已解锁~',
                                    icon: 'none'
                                });
                                that.$emit('refresh');
                            });
                        },
                        handleVirtualAssetPick: function () {
                            var that = this;
                            t.showModal({
                                title: '确认领取此奖品吗?',
                                success: function (n) {
                                    if (n.confirm) {
                                        that.$http('/package-skus/'.concat(that.info.uuid, '/virtual-asset/pick'), 'POST').then(function (n) {
                                            t.showToast({
                                                title: '领取成功，即将跳转~',
                                                icon: 'none'
                                            });
                                            setTimeout(function () {
                                                t.navigateTo({
                                                    url: '/pages/myBox/detail?uuid=' + that.order.uuid
                                                });
                                            }, 1500);
                                        });
                                    }
                                }
                            });
                        },
                        checkResaleDetail: function () {
                            t.navigateTo({
                                url: '/pages/resale/detail?uuid=' + this.order.resale.uuid
                            });
                        },
                        fillNumber: function (t) {
                            return t < 10 ? '0' + t : t;
                        },
                        handleClick: function () {
                            if (this.isSelectMode) {
                                return 'virtual_asset' !== this.order.sku_type_text && !!this.isSelectable && (this.$emit('check'), false);
                            }
                            t.navigateTo({
                                url: '/pages/myBox/detail?uuid=' + this.order.uuid
                            });
                        },
                        handleClick2: function (t) {
                            this.$emit('action', {
                                order: this.order,
                                action: t.currentTarget.dataset.type
                            });
                        },
                        handleCheck: function () {
                            this.$emit('check');
                        },
                        handleCoverChip: function () {
                            t.navigateTo({
                                url: '/pages/coverChip/index?sku_id=' + this.order.skus[0].sku_id
                            });
                        }
                    }
                };
                e.default = o;
            }.call(this, n('543d').default));
        },
        '344f': function (t, e, n) {},
        3564: function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('0aa3');
            var o = n.n(i);
            for (var s in i) {
                if (['default'].indexOf(s) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return i[t];
                        });
                    })(s);
                }
            }
            e.default = o.a;
        },
        '526f': function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return i;
            });
            n.d(e, 'c', function () {
                return o;
            });
            n.d(e, 'a', function () {});
            var i = function () {
                this.$createElement;
                var t = (this._self._c, this.$tool.formatDate(this.order.created_at, 'MM-dd hh:mm'));
                this.setData(
                    Object.assign(
                        {},
                        {
                            $root: {
                                g0: t
                            }
                        }
                    )
                );
            };
            var o = [];
        },
        de82: function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('526f');
            var o = n('3564');
            for (var s in o) {
                if (['default'].indexOf(s) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return o[t];
                        });
                    })(s);
                }
            }
            n('fe1c');
            var a = n('f0c5');
            var r = Object(a.a)(o.default, i.b, i.c, false, null, null, null, false, i.a, void 0);
            e.default = r.exports;
        },
        fe1c: function (t, e, n) {
            'use strict';

            var i = n('344f');
            n.n(i).a;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'pages/myBox/components/PackageSku-create-component',
    {
        'pages/myBox/components/PackageSku-create-component': function (t, e, n) {
            n('543d').createComponent(n('de82'));
        }
    },
    [['pages/myBox/components/PackageSku-create-component']]
]);
</script>
<style>
@import './PackageSku.css';
</style>
